package org.lee.pattern.observer.demo;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.lee.pattern.observer.Observer;

import java.util.concurrent.TimeUnit;

/**
 * Thread1
 * 测试实例1
 *
 * @author dralee
 * @date 2022-03-09 10:18:53
 **/
@Slf4j
public class Thread1 implements Observer, Runnable {

    @SneakyThrows
    @Override
    public void run() {
        log.info("thread1 running...");
        TimeUnit.SECONDS.sleep(1);
        log.info("thread1 end.");
    }

    @Override
    public void exceptionHandler() {
        log.info("thread1 rollback...");
    }
}
